import request from "@/utils/request";

export function addProduct(data) {
  return request({
    url: "/api/product/add",
    method: "post",
    data,
  });
}

export function updateProduct(data) {
  return request({
    url: "/api/product/update",
    method: "post",
    data,
  });
}

export function reqProductInfo(category,pageNo,pageSize){
  return request({
    url:`/api/product/${category}?pageNo=${pageNo}&pageSize=${pageSize}`,
    method:"get"
  })
}

export function delProduct(data) {
  return request({
    url: `/api/product/remove`,
    method: "post",
    data
  });
}

export function delBatchProduct(data) {
  return request({
    url: "/api/product/delBatch",
    method: "post",
    data,
  });
}

export function searchProduct(productName,category){
  return request({
    url: `/api/product?category=${category}&productName=${productName}`,
    method: "get",
  });
}

export function reqCategoryList(){
    return request({
        url: '/api/categoryList',
        method:'get'
    })
}